package com.yuanfeng.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.yuanfeng.base.entity.BaseTreasureGradeEntity;
import com.yuanfeng.base.mapper.BaseTreasureGradeMapper;
import com.yuanfeng.base.service.BaseTreasureGradeService;
import com.yuanfeng.commoms.util.ResponseResult;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 *
 */
@Service
public class BaseTreasureGradeServiceImpl extends ServiceImpl<BaseTreasureGradeMapper, BaseTreasureGradeEntity>
    implements BaseTreasureGradeService{

    @Override
    public ResponseResult queryTreasureGrade() {
        List<BaseTreasureGradeEntity> gradeList = this.baseMapper.selectList(new LambdaQueryWrapper<BaseTreasureGradeEntity>().orderByDesc(BaseTreasureGradeEntity::getDisplayOrder));
        if (CollectionUtils.isEmpty(gradeList)) {
            gradeList = Lists.newArrayList();
        }
        return ResponseResult.success(gradeList);
    }
}




